<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="expires" content="Thu,01 Jan 1970 00:00:01 GMT">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <!--<meta http-equiv="Content-Security-Policy" content="default-src 'self';font-src 'self' data: https://fonts.gstatic.com https://fonts.googleapis.com/;style-src 'self' 'unsafe-inline'; media-src *;script-src 'self' http://api.map.baidu.com ;">-->
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <link href="__IMG__/logo.png" rel="shortcut icon" type="image/x-icon">
    <title>花椒-辣椒-香料-调味品-附城--成都味之初农产品有限公司</title>
    <base target="_self">
    <meta name="keywords" content="成都调味品批发交易贸易，花椒，辣椒，香料，成都调味品">
    <meta name="description" content="成都味之初农产品有限公司,专注于花椒，辣椒，香料等调味品批发贸易">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="__LIB__/layui/css/layui.css">
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" href="__CSS__/reset.css">
    <link rel="stylesheet" href="__CSS__/common.css">
    <link rel="stylesheet" href="__CSS__/user_pwd_update.css">
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?68cca1e88d91513304d45edd3b72a6ba";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</head>
<body>
    <top class="prod-huajiao">
        <header class="navbar navbar-default">
            <div class="container">
                <!--小屏幕导航按钮和logo-->
                <div class="navbar-header">
                    <button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <div id="logo-part-for-mobile" style="display: none;">
                        <a href="http://cdweizhichu.com/">
                            <img src="__IMG__/logo.png" class="logo">
                            <span>附城</span>
                        </a>
                    </div>
                </div>
                <!--小屏幕导航按钮和logo-->
                <!--导航-->

                <div class="navbar-collapse collapse">
                    <div id="logo-part-for-pc">
                        <h1 style="display: inline-block;">
                            <a href="http://cdweizhichu.com/" style="display: block">
                                <img src="__IMG__/logo.png" class="logo">
                                <span class="logo-right-txt">附城</span>
                            </a>
                        </h1>
                    </div>
                    <ul id="main-navigation" class="nav navbar-nav">
                        <li>

                            <a href="/">附城</a>

                        </li>
                        <li >
                            <a href="/index/index/huajiao">花椒</a>
                        </li>
                        <li class="">

                            <a href="/index/index/lajiao">辣椒</a>

                        </li>
                        <li class="">

                            <a href="/index/index/xiangliao">香料</a>

                        </li>
                        <li class="prod-center active">

                            <a href="#">产品中心<i class="nav-arrow-up"></i></a>

                            <ul>
                                <li><a href="/index/index/prodhuajiao" style="background: #CE7D3A;color: #fff;">花椒产品</a></li>
                                <li><a href="/index/index/prodlajiao">辣椒产品</a></li>
                                <li><a href="/index/index/prodxiangliao">香料产品</a></li>
                                <li><a href="/index/index/prodquality">精品展示</a></li>
                            </ul>
                        </li>
                        <li class="">

                            <a href="./news.html">最新资讯</a>

                        </li>
                        <li class="">

                            <a href="./story.html">故事欣赏</a>

                        </li>
                    </ul>
                </div>
                <!--导航-->
            </div>
        </header>
    </top>

    <div class="user-info">
        <div class="title"><span></span>修改密码</div>
        <div class="user-edit-area">
            <div class="item">
                <span class="info-label">手机号:</span>
                <input type="text" id="phone" placeholder="请输入注册时使用的手机号" {$userinfo?"disabled":""} value="">
                <div class="tips"></div>
            </div>
            <div class="item">
                <span class="info-label">图形验证码:</span>
                <input type="text" id="code"   placeholder="请输入验证码" maxlength="20">
                <img src="/index/Sms/checkVerify" id="imgCode">
                <div class="tips"></div>
            </div>
            <div class="item">
                <span class="info-label">验证码:</span>
                <input type="text" id="captcha"  placeholder="请输入短信验证码">
                <button class="btn" id="getCaptcha">获取验证码</button>
                <div class="tips"></div>
            </div>
            <div class="item">
                <span class="info-label">新密码:</span>
                <input type="password" id="pwd"   placeholder="6-20位密码" maxlength="20">
                <div class="tips"></div>
            </div>
            

            <div class="item update_confirm">
                <span class="info-label"></span>
                <button class="btn btn-primary" id="post_update">确定</button>
            </div>
        </div>
    </div>

    {include file="/common" /}

    <!--user part-->
    {include file="index@base/userinfo"}

    <div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
        <div id="innerdiv" style="position:absolute;">
            <img id="bigimg" style="border:5px solid #fff;" src="" />
        </div>
    </div>
</body>
<script src="__JS__/jQuery-1.11.1.min.js"></script>
<script src="__LIB__/layui/layui.js"></script>
<script>
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>
<script>
    $(function () {
        $('.user-fixed-right').mouseenter(function () {
            $(this).css({right:0,height:'200px',background:'#3A394D',borderColor: '#333',borderRadius:0,transition:'all .3s ease-out'})
            $('.user-edit').show()
        }).mouseleave(function () {
            $(this).css({right:'-50px',height:'100px',background:'#fff',borderColor: '#efa123',borderRadius:'50%',transition:'all .3s ease-out'})
            $('.user-edit').hide()
        })
    })
</script>
<script>
    $(function () {
        layui.use('layer', function() { //独立版的layer无需执行这一句
            var layer = layui.layer; //独立版的layer无需执行这一句
        })
        $.get('/index/member/getOneMember',function (res) {
            if(res.code == 1) {
                $('#phone').val(res.msg.memb_phone)
            }
        },'json')
        /*手机验证*/
        var telCheck = /^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/
        var hasPost = true

        /*刷新图形验证码*/
        $('#imgCode').on('click',function () {
            var nowTime = new Date().getTime()
            $(this)[0].src = '/index/Sms/checkVerify?time='+nowTime
        })
        $('#getCaptcha').on('click',function () {
            if(!$('#phone').val()) {
                $('#phone').css({borderColor:'#ff0036'})
                $('#phone').siblings('.tips').html('请输入手机号')
                return
            }
            if(!telCheck.test($('#phone').val())) {
                $('#phone').css({borderColor:'#ff0036'})
                $('#phone').siblings('.tips').html('请输入正确的手机号')
                return
            }
            if(!hasPost) return
            var time = 60
            var code = $(this)
            $.post('/index/Sms/index',{phone:$('#phone').val(),code:$('#code').val()},function (res) {
                if(res.code == 1) {
                    $('#code').siblings('.tips').html('')
                    var t = setInterval(function () {
                        hasPost = false
                        time--;
                        code.html(time + "s");
                        if (time == 0) {
                            clearInterval(t);
                            code.html("重新获取");
                            hasPost = true
                        }
                    }, 1000)
                }else {
                    $('#code').siblings('.tips').html('验证码错误')
                }
            })
       })

        /*输入密码*/
        var pwd_letter = /^[a-zA-Z]{6,20}$/;  //弱，全字母
        var pwd_num = /^[0-9]{6,20}$/;  //弱，全数字
        var pwd_char = /^((?=[\x21-\x7e]+)[^A-Za-z0-9]){6,20}$/;  //弱，全字符
        $('#pwd').on('focus',function () {
            /*if(!$(this).val()) {
                $(this).siblings('.tips').html('请输入6-20位密码')
            }*/
        }).on('blur',function () {
            if($(this).val().length < 6) $(this).siblings('.tips').html('请输入6-20位密码')
            else if(pwd_letter.test($(this).val())) $(this).siblings('.tips').html('不能为全字母')
            else if(pwd_num.test($(this).val())) $(this).siblings('.tips').html('不能为全数字')
            else if(pwd_char.test($(this).val())) $(this).siblings('.tips').html('不能为全字符')
            else $(this).siblings('.tips').html('')
        })

        /*/!*重复密码*!/
        $('#re_pwd').on('blur',function () {
            if($(this).val() !== $('#pwd').val()) {
                $(this).siblings('.tips').html('密码不一致')
            }
        })*/

        /*确认修改*/
        $('#post_update').on('click',function() {
            $('#captcha').siblings('.tips').html('')
            var errCount = 0
            $('.tips').each(function (i,v) {
                if(v.innerText) errCount++
            })
            if(errCount > 0) return
            $.post('/index/Login/memberPwd',{
                    password: $('#pwd').val(),
                    code: $('#captcha').val()
                },function (res) {
                    if(res.code == 1) {
                        $('#captcha').siblings('.tips').html('')
                        layer.msg('修改成功！',{icon: 1,time: 2000})
                        setTimeout(function () {
                            window.location.href = '/index/index/login.html'
                        }, 3000)
                    }else {
                        $('#captcha').siblings('.tips').html('验证码错误')
                    }
                },'json')
        })

        if(window.screen.width < 500) {
            var prodUl = true
            $('.prod-center>a').on('click',function () {
                if(prodUl) {
                    $(this).siblings().show()
                    $(this).find('.nav-arrow-up').css({transform:'translateY(-20%) rotate(315deg)',transition:'all .35s ease-in-out'})
                    prodUl = false
                }else {
                    $(this).siblings().hide()
                    $(this).find('.nav-arrow-up').css({transform:'translateY(-50%) rotate(135deg)'})
                    prodUl = true
                }
            })
            setTimeout(function () {
                $('.navbar-collapse').children('#logo-part-for-pc').remove()
                $('.collapse').css({height:0,overflow:'hidden',border:'none'}).show()
                $('#logo-part-for-mobile').show()
            }, 800)
        }else{
            setTimeout(function () {

            },800)
        }


        //手机屏下的导航显示
        var toggleState = true
        $('.navbar-toggle').on('click',function () {
            if(toggleState){
                $('.navbar-collapse').css({transform:'scaleY(1)',transformOrigin:'top',transition: 'all .35s ease'})
                if($('.prod-center ul').css('display') === 'block') {
                    setTimeout(function () {
                        $('.navbar-collapse').css({height:'350px'})
                    }, 380)
                }
                toggleState = false
            }else{
                $('.navbar-collapse').css({transform:'scaleY(0)',transformOrigin:'top',transition: 'all .35s ease'})
                if($('.prod-center ul').css('display') === 'block') $('.prod-center ul').css('display') === 'none'
                toggleState = true
            }
        })
        $('.prod-center').on('click',function () {
            if($('.prod-center ul').css('display') === 'block') $('.navbar-collapse').css({height:'350px'})
            else $('.navbar-collapse').css({height:'302px'})
        })

    })
</script>
</html>